package com.cloudfun.campusshare.service.impl;

import com.cloudfun.campusshare.RemoteDeviceService;
import com.cloudfun.campusshare.entity.DeviceEntity;
import com.cloudfun.campusshare.repo.DeviceEntityRepo;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Huqin on 2019/12/26
 */
public class RemoteDeviceServiceImpl implements RemoteDeviceService {

    @Autowired
    private DeviceEntityRepo deviceEntityRepo;

    @Override
    public String getUserIdByImei(String imei) {
        DeviceEntity deviceEntity = deviceEntityRepo.findByImei(imei);
        if (null == deviceEntity) {
            return null;
        }
        return deviceEntity.getUserId();
    }

    @Override
    public String getAppIdByImei(String imei) {
        DeviceEntity deviceEntity = deviceEntityRepo.findByImei(imei);
        if (null == deviceEntity) {
            return null;
        }
        return deviceEntity.getAppId();
    }
}
